package com.wayne.utils;

import java.sql.Connection;
import java.sql.SQLException;

public class ConnectionPool {
  private ThreadLocal<Connection> threadLocal = new ThreadLocal<>();

  public ConnectionPool() {
  }

  public Connection getCurrentConnection() throws SQLException {
    Connection connection = threadLocal.get();
    if (connection == null) {
      connection = DruidUtils.getInstance().getConnection();
      threadLocal.set(connection);
    }
    return connection;
  }
}
